// File: jmcomic-core/src/main/java/dev/jukomu/jmcomic/exception/RegularNotMatchException.java
package dev.jukomu.jmcomic.exception;

import java.util.Map;
import java.util.regex.Pattern;

/**
 * 对应Python的RegularNotMatchException，表示正则表达式不匹配。
 */
public class RegularNotMatchException extends JmcomicException {
    public static final String DESCRIPTION = "正则表达式不匹配异常";

    public RegularNotMatchException(String message, Map<String, Object> context) {
        super(message, context);
    }

    public RegularNotMatchException(String message, Map<String, Object> context, Throwable cause) {
        super(message, context, cause);
    }

    /**
     * 获取导致异常的HTML文本。
     *
     * @return HTML字符串
     */
    public String getErrorText() {
        return fromContext(ExceptionUtils.CONTEXT_KEY_HTML);
    }

    /**
     * 获取导致异常的正则表达式模式。
     *
     * @return Pattern对象
     */
    public Pattern getPattern() {
        return fromContext(ExceptionUtils.CONTEXT_KEY_RE_PATTERN);
    }
}